package com.quanyan.user.init;

import com.quanyan.user.service.SendMsgService;
import com.quanyan.user.service.UserTaskService;
import com.quanyan.user.service.UserTreasureBoxService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;

/**
 * Created by jian.zhou on 2016/7/4.
 * 启动时 加载 系统任务 和宝箱到缓存
 */
@Component
public class TaskAndBoxInit implements CommandLineRunner {

    private static final Logger logger = LoggerFactory.getLogger(TaskAndBoxInit.class);

    @Autowired
    private UserTaskService userTaskService;

    @Autowired
    private UserTreasureBoxService userTreasureBoxService;

    @Autowired
    private SendMsgService sendMsgService;

    @Override
    public void run(String... strings) throws Exception {
        logger.info("star init redis");
        userTaskService.initSystemTask();

        userTreasureBoxService.initSystemBox();
        logger.info("end up init redis ------------------------->");

        sendMsgService.initPushFlag();
    }
}
